local highbeamsActive = false
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        local veh = GetVehiclePedIsIn(PlayerPedId(), false)
        if (IsPedInAnyVehicle(PlayerPedId(), true)) and (GetPedInVehicleSeat(veh, -1) == PlayerPedId()) then
            if IsControlPressed(0, Config.shortcutKey) then
                -- 当按住 G 键时，切换远光灯状态
                if not highbeamsActive then
                    SetVehicleFullbeam(veh, true)
                    highbeamsActive = true
                end
            elseif not IsControlPressed(0, Config.shortcutKey) and highbeamsActive then
                -- 当不再按住 G 键且远光灯处于打开状态时，关闭远光灯
                SetVehicleFullbeam(veh, false)
                highbeamsActive = false
            end
        end
    end
end)
